Update integer advanced indexing for array API 2024.12 spec#2032
Update integer advanced indexing for array API 2024.12 spec#2032ndgrigorian merged 13 commits intomasterfrom
Conversation
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_75 ran successfully. |
619dbfd to
a02b5e5
Compare
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_78 ran successfully. |
a02b5e5 to
71ca729
Compare
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_104 ran successfully. |
71ca729 to
d426408
Compare
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_109 ran successfully. |
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_110 ran successfully. |
array API 2024 spec requires advanced indexing with integer arrays, and when advanced indexing behavior is triggered, integral scalars are to be converted to arrays and broadcast with the other indices
this fixes cases like `x[..., arr1, int1, arr2, int2, :, int3]`, the final int will be treated as an integer instead of an array, and `arr1` through `int2` will be treated as arrays
since the index is on the host, we can raise like we normally would, which follows NumPy behavior
Reduces code duplication
Typos from advanced indexing updates
Test for the case where an basic integral index appears between two integral arrays, followed by a basic index, and then followed by `:`
12e2121 to
d873f35
Compare
|
@antonwolfy |
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_116 ran successfully. |
0D array indices are treated as Python scalars and moved to the host when not part of other, consecutive array indices This means that 0D arrays also can't start a series of consecutive advanced indices
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_123 ran successfully. |
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_126 ran successfully. |
…en not among consecutive integer arrays
|
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_128 ran successfully. |
antonwolfy
left a comment
There was a problem hiding this comment.
Thank you @ndgrigorian, LGTM
The array API specification now requires advanced integer indexing (i.e., with arrays) to promote Python integer scalars to arrays when mixed with integer arrays.
This PR implements this behavior, promoting any integer indices that occur in a sequence with array indices of dimension 1 or greater.